<?php

/**
 * This is the model class for table "luasareaperkebunanrakyat".
 *
 * The followings are the available columns in table 'luasareaperkebunanrakyat':
 * @property string $lapr_id
 * @property string $lapr_jenis
 * @property double $lapr_tbm_produktif
 * @property double $lapr_tbm_nonproduktif
 * @property double $lapr_tanaman_rusak
 * @property double $lapr_produksi
 * @property integer $lapr_tahun
 */
class Luasareaperkebunanrakyat extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Luasareaperkebunanrakyat the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'luasareaperkebunanrakyat';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('lapr_tahun', 'numerical', 'integerOnly'=>true),
			array('lapr_tbm_produktif, lapr_tbm_nonproduktif, lapr_tanaman_rusak, lapr_produksi', 'numerical'),
			array('lapr_jenis', 'length', 'max'=>64),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('lapr_id, lapr_jenis, lapr_tbm_produktif, lapr_tbm_nonproduktif, lapr_tanaman_rusak, lapr_produksi, lapr_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'lapr_id' => 'Lapr',
			'lapr_jenis' => 'Jenis Tanaman',
			'lapr_tbm_produktif' => 'Tanaman Muda Produktif',
			'lapr_tbm_nonproduktif' => 'Tanaman Muda Nonproduktif',
			'lapr_tanaman_rusak' => 'Tanaman Rusak/Tua Nonproduktif',
			'lapr_produksi' => 'Tanaman Rusak/Tua Produksi',
			'lapr_tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('lapr_id',$this->lapr_id,true);
		$criteria->compare('lapr_jenis',$this->lapr_jenis,true);
		$criteria->compare('lapr_tbm_produktif',$this->lapr_tbm_produktif);
		$criteria->compare('lapr_tbm_nonproduktif',$this->lapr_tbm_nonproduktif);
		$criteria->compare('lapr_tanaman_rusak',$this->lapr_tanaman_rusak);
		$criteria->compare('lapr_produksi',$this->lapr_produksi);
		$criteria->compare('lapr_tahun',$this->lapr_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}